home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / H-I / HyperHackers.cpt / Hyper-Hackers Queue 1.0 / card_37353.txt < prev    next >
Text File  |  1989-02-26  |  1KB  |  47 lines

  1. -- card: 37353 from stack: in.0
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 3797
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 1
  9. ----- text -----
  10.  
  11. From: edmoy@violet.berkeley.edu
  12.  
  13. Date: 10 Mar 88 19:48:15 GMT
  14.  
  15. >I am looking for this, and basically do the following:
  16.  
  17. >    if ( (target = OpenResFile( targetFile )) == -1 )
  18. >    {    CreateResFile( targetFile );
  19. >        if ( ResError() != noErr )
  20. >        {
  21. >            return;
  22. >        }
  23. >        else if ( target = OpenResFile( targetFile ) == -1 )
  24. >        {
  25. >            return;
  26. >        }
  27. >    }
  28.  
  29. If this is exactly the code you use, then the problem is in:
  30.  
  31.         else if ( target = OpenResFile( targetFile ) == -1 )
  32.  
  33. You forgot the extra pair of parenthesis, as in
  34.  
  35.         else if ((target = OpenResFile( targetFile )) == -1 )
  36.     
  37. What you were doing is calling OpenResFile() and testing if it was -1.  If
  38. it was, target was set to 1 (true) and your routine started to do its thing
  39. on what every resource file 1 was (maybe the System file).  Although I would
  40. have expected that OpenresFile() to return a positive number, which doesn't
  41. match -1, so target becomes 0 and your routine returns.
  42.  
  43.  
  44.  
  45. -- part contents for background part 45
  46. ----- text -----
  47. Re: the target